// Returns a random integer between min (included) and max (included)
function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max -min+1)) + min;
}

function isRandPercent(percent){
    let tmp=getRandomInt(1, 100);
    return tmp>=1&&tmp<=percent;
}

function getKNum(num){
    if(num>1000){
       let tmp=num/1000;
       return tmp.toFixed(1)+"K";
    }
    return num.toString();
}

module.exports = {
    getRandomInt: getRandomInt,
    isRandPercent:isRandPercent,
    getKNum:getKNum
};
